﻿using SmartSpace.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SmartSpace.Orgs.UI.pages
{
    public partial class NodeTypeList : SsTemplatePage
    {
        protected override void OnLoad(EventArgs e)
        {
            if (!IsPostBack)
            {
                BindNodeTypeList();
            }
        }
         
        public void BindNodeTypeList()
        {
            OrgsService service = new OrgsService();
            ListResult<NodeType> list = service.GetTypes();

            this.rep1.DataSource = list.Data;
            this.rep1.DataBind();

            ListResult<NodeType> list1 = service.GetSubTypes(Guid.NewGuid());
        }

        protected void rep1_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            OrgsService service = new OrgsService();
            if (e.CommandName == "Delete")
            {
                bool bl = service.DeleteType(e.CommandArgument.ToString());

                if (bl)
                {
                    Response.Redirect("NodeTypeList.aspx");
                }
            }
        }
    }
}